$(document).ready(function () {
    bssfsq.onload();
})
var bssfsq = (function () {
    return {
        onload : function () {
            bssfsq.tableData();
            bssfsq.delAllBtn();
        },
       /*表格数据交互*/
      tableData: function() {
 		var data = [{
 				"number": "1",
 				"account": "1234567898764567",
 				"name": "其他有限责任有限公司",
 				"phone":"13456781913",
 				"applyname":"林林",
 				"date":"2018-08-24",
 				"state": "已授权"
 			},
 			{
 				"number": "2",
 				"account": "1234567898764567",
 				"name": "其他有限责任有限公司",
 				"phone":"13456781913",
 				"applyname":"林林",
 				"date":"2018-08-24",
 				"state": "未授权"
 			},
 			{
 				"number": "3",
 				"account": "1234567898764567",
 				"name": "其他有限责任有限公司",
 				"phone":"13456781913",
 				"applyname":"林林",
 				"date":"2018-08-24",
 				"state": "已授权"
 			},
 			{
 				"number": "4",
 				"account": "1234567898764567",
 				"name": "其他有限责任有限公司",
 				"phone":"13456781913",
 				"applyname":"林林",
 				"date":"2018-08-24",
 				"state": "已授权"
 			}
 		];
 		$('#wepBssfsq').DataTable({
 			"data": data,
 			"columnDefs": [
 				{
 					'targets': 0,
 					'className': 'dt-body-center',
 					'render': function(data, type, row) {
 						return '<input class="checkchild" type="checkbox"/>';
 					}
 				}
 			],
 			"columns": [
 			    {
 					"data": "btn"
 				},
 			    {
 					"data": "number"
 				},
 				{
 					"data": "account"
 				},
 				{
 					"data": "name"
 				},
 				{
 					"data": "phone"
 				},
 				{
 					"data": "applyname"
 				},
 				{
 					"data": "date"
 				},
 				{
 					"data": "state"
 				}
 			],
// 			"paging": false,
 			"info": false,
 			"ordering": false,
 			"lengthChange": false,
 			"searching": false,
 			"fnInitComplete": function (oSettings, json) {/*判断认证状态显示字体颜色*/
	            for(var i=0;i<$('#wepBssfsq tbody tr').length;i++){
	            	if($('#wepBssfsq tbody tr').eq(i).find('td').eq(7).text() == "已授权"){
	            		$('#wepBssfsq tbody tr').eq(i).find('td').eq(7).addClass('ycl')
	            	}else{
	            		$('#wepBssfsq tbody tr').eq(i).find('td').eq(7).addClass('wcl')
	            	}
	            }
	        }
 		});
      },
      /*点击取消授权*/
   	  delAllBtn:function(){
   		$('.wep_rz_qxsq').on('click',function(){
   			parent.yhzx_zrr.delAll("确定要取消授权吗？");
   		})
   	  }
    }
})();